<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>词多多代理商平台</title>
    <include file="Index:header" />
    <script type="text/javascript">
        $(function(){
            $(".help-side dl dd:eq(8)").addClass('cur');
        })
    </script>
    <script src="__PUBLIC__/js/main.js" type="text/javascript" charset="UTF-8"></script>
</head>
<body>
<include file="Index:top"/>
<div id="main">
    <include file="User:left"/>
    <div id="main_right" class="container">
        <div class="title">发送广播</div>
        <div id="proxyinfo" class="container p10 mt10" style="background-color:#FAFAFA;">
            <form action="{:U('publish')}" method="post">
                <table class="tableStyle" cellpadding="15">
                    <tr>
                        <td colspan="5" width="80%" align="center">
                            <input type="text" name="title" id="title" class="input" style="width:500px; height:40px;" value="请填写标题"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5" align="center">
                  <textarea class="input" name="contents" id="content" style="width:500px;height:200px;"></textarea>
                        </td>
                    </tr>

                    <if condition="$agentId eq 1">
                        <tr>
                            <td width="10%"></td>
                            <td style="padding-left:50px;"><input type="radio" name="type" id="all" value="1">全部客户</td>
                            <td><input type="radio" name="type" id="selagent" value="2">指定代理商的客户</td>
                            <td><input type="radio" name="type" id="seluser" value="3">代理商指定客户</td>
                            <td width="10%"></td>
                        </tr>
                    </if>

                    <if condition="$agentId eq 1">
                        <tr>
                            <td></td>
                            <td id="agent"  style="display: none; padding-left:50px;" colspan="1">
                                <div id="agentId" class="dropdown" tabIndex="1"  style="width:100px;">
                                    <select onchange="sel();">
                                        <option value="">请选择代理商</option>
                                    </select>
                                </div>
                            </td>
                            <td colspan="2" id="user"  style="display: none;">
                                <div id="userId" class="dropdown" tabIndex="1" style="width:100px;">
                                    <select style="width:150px;" onchange="sel();">
                                        <option value="">请选择用户</option>
                                    </select>
                                </div>
                            </td>
                            <td></td>
                        </tr>
                        </if>

                        <tr>
                            <td colspan="5" align="center">
                            <input class="button green" type="submit" name="button" id="button" value="发布"/>
                        </td>
                        </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<div id="footer">
    Copyright © Cidodo.com 2013 ShanDong YiShang Technology Co.,Ltd
    <br/>
    鲁ICP备13010818号 山东易商科技版权所有
</div>
<script type="text/javascript">

    $(function(){
        $("#agentId").sSelect();
        $("#userId").sSelect();
    });

$(function(){
  $("#content").val("更多的交流，更贴近的心");
  $("#content").css("text-align","center").css("font-size","20px").css("line-height","200px");
  $("#title").focus(function(){
      var str=$(this).val();
      str= $.trim(str);
      if(str=="请填写标题"){
          $(this).val("");
      }
  });
   $("#title").blur(function(){
       var str=$(this).val();
       str= $.trim(str);
       if(str==""){
           $(this).val("请填写标题");
       }
   });
    $("#content").focus(function(){
        var str=$(this).val();
        str= $.trim(str);
        if(str=="更多的交流，更贴近的心"){
            $(this).val("");
            $("#content").css("text-align","").css("font-size","").css("line-height","");
        }
    });
    $("#content").blur(function(){
        var str=$(this).val();
        str= $.trim(str);
        if(str==""){
            $(this).val("更多的交流，更贴近的心");
           $("#content").css("text-align","center").css("font-size","20px").css("line-height","200px");
        }
    });
});

$("#all").click(function(){
    $("#agent").hide();
    $("#user").hide();
});

$("#selagent").click(function(){
    $("#agent").show();
    $("#user").hide();
});

$("#seluser").click(function(){
    $("#agent").show();
    $("#user").show();
});
    $("#selagent").click(function(){

        get_url = "__APP__/Agent/getagent";
        $.ajax({
            url:get_url,
            type:'POST',
            cache:false,
            dataType:"json",
            success:function(data){
                if(data.status =='true'){
                    $("#site option:gt(0)").remove();
                    $.each(data,function(n,value){
                        if(value!='true'){
                            $("#site").append("<option value="+value+">"+value+"</option>");
                        }
                    });
                }else{
                    msgwarn(data.errMsg);
                }
            }
        });
    });
</script>
</body>
</html>